package servlet.admin;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import service.OrderService;
import service.SearchIndexpagere;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/admindeletebook")
public class DeleteBook extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        OrderService orderService = new OrderService();
        SearchIndexpagere searchIndexpagere = new SearchIndexpagere();
        int i = searchIndexpagere.adminDeleteBook(id);
        resp.setContentType("application/json;charset=utf-8");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code",1);
        String jsonString = JSON.toJSONString(jsonObject);
        PrintWriter writer = resp.getWriter();
        writer.write(jsonString);
    }
}
